package com.wyx.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.NonNull;

import java.time.LocalDateTime;

@Data //lombok.@Data在编译时为实体类添加getter/setter/toString/equals/hashCode等方法
public class User {
    private Integer id;
    private String username;
    @JsonIgnore //忽略字段，不进行序列化
    private String password;
    @NotNull //校验,不能为空
    @Pattern(regexp = "^\\S{3,16}$")
    private String nickname;
    @Email //校验,必须为邮箱
    @NotNull
    private String email;
    private String icon;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
